home *** CD-ROM | disk | FTP | other *** search
/ Octamed 6 / Octamed 6.iso / c / play16.doc < prev    next >
Text File  |  1995-07-02  |  22KB  |  510 lines

  1.  
  2. ---------------------------------------------------------------------------
  3. -- Play16 version 1.5 (02.07.95) - a versatile soundplayer for the Amiga --
  4. ---------------------------------------------------------------------------
  5.  
  6. Features in brief
  7. -----------------
  8.  - autodetects and plays several soundfiles, up to 16 bit / 56 kHz / stereo
  9.  - full Workbench support (but not Intuition and no GUI)
  10.  - always correct playback speed, even for sounds >28 kHz
  11.  - realtime playback from harddisk, optimized assembler routines
  12.  - optional 14 bit output (less noise but not as good as true 16 bit)
  13.  - automatic or manual audio filter control
  14.  - plays mono sounds on *both* channels, not only on the left one
  15.  - plays (and loops) files that are larger than memory
  16.  - preloading for exactly timed start of playback
  17.  - fast uLaw decompression
  18.  - system friendly audio channel allocation
  19.  - optionally dump the output into a file (can be used to convert sounds)
  20.  - supported Filetypes are:
  21.  
  22.    * Microsoft RIFF-WAVE  (.WAV)  mono / stereo, 8 / 16 bit, linear / uLaw
  23.    * Creative Voice File  (.VOC)  mono / stereo, 8 / 16 bit, linear
  24.    * Sun/NeXT Audio       (.AU)   mono / stereo, 8 / 16 bit, linear / uLaw
  25.    * MacroSystem MAUD     (.MAUD) mono / stereo, 8 / 16 bit, linear / uLaw
  26.    * Apple/SGI/Amiga AIFF (.AIFF) mono / stereo, 8 / 16 bit, linear
  27.    * Amiga IFF-8SVX       (.IFF)  mono / stereo, 8      bit, linear / FibDelta
  28.    * Any raw sound data as long as it matches one of the following:
  29.      -  8 bit signed
  30.      -  8 bit unsigned
  31.      - 16 bit signed, Intel format    (LSB first)
  32.      - 16 bit signed, Motorola format (MSB first)
  33.  
  34.     - supported output devices are:
  35.  
  36.    * Native Amiga chipset (Paula)  8 bit
  37.    * Native Amiga chipset (Paula) 14 bit
  38.    * Native Amiga chipset (Paula) 14 bit calibrated (Christian Buchner)
  39.    * MacroSystem Maestro Pro      16 bit 44.1kHz and 48kHz only
  40.    * IFF-8SVX file dump            8 bit
  41.  
  42. ========================== Section 1: Quick start =========================
  43.  
  44. What do I need to use Play16?
  45. -----------------------------
  46. Any Amiga running Kickstart/Workbench 2.04 or greater.
  47.  
  48. To use the calibrated 14 bit output you need a valid CyberSound preferences
  49. file in your ENVARC: directory. If you don't have one already it can be
  50. generated with Christian's calibration package included in this distribution.
  51.  
  52. Maestix.library V38 or higher is required to use the MPro board for output.
  53.  
  54. Where do I find the latest version?
  55. -----------------------------------
  56.  - FIDONET: Amiga Venture BBS, Germany (2:243/6050)
  57.  - AMINET:  mus/play
  58.  - WWW:     http://linux.rz.fh-hannover.de/~wenzel/Play16/
  59.  
  60. further I recommend to have a look at the following packages:
  61.  
  62. CyberSound:
  63.  - AMINET:  disk/cdrom/14Bit_CDPlayer.lha
  64.  
  65. Maestix:
  66.  - AMINET:  util/libs/Maestix39_00.lha
  67.  
  68. How do I use it?
  69. ----------------
  70. From CLI:       Simply type "Play16 <filename>" and that's it!
  71. From Workbench: Just doubleclick on it's icon. A filerequester will pop up.
  72.  
  73. All possible options will be explained later. If you set none of them, the
  74. defaults will be used.
  75.  
  76.  
  77. ==================== Section 2: Background information ====================
  78.  
  79. What does it do?
  80. ----------------
  81. Basically, Play16 is capable of playing uncompressed and _some_ compressed
  82. soundfiles through Amiga's standard audio device or an increasing number of
  83. alternative devices. If the actual resolution or playback rate exceeds that
  84. of the Amiga hardware, realtime conversion is done so that the sound is
  85. being played back correctly.
  86.  
  87. You can even play 16 bit / 44.1 kHz sounds, providing all parts of
  88. your system can keep up with the high data transfer rate and lots
  89. of calculations needed for this task. (In this case an accelerated
  90. Amiga is recommended :-)
  91.  
  92. The two audio channels at each side can be linked to perform as a single
  93. 14 bit channel. Again, this swallows lots of computing power.
  94.  
  95. Anyway, my Amiga 3000-16MHz is fast enough to play an uncompressed soundfile
  96. with full 44.1kHz/14bit output (productivity) directly from harddisk !!!
  97.  
  98. I don't want Play16 to be a program that plays each and every exotic format
  99. that exists somewhere. However, I intend to support as many popular file
  100. types as possible.
  101.  
  102.  
  103. Why Play16?
  104. -----------
  105. 16 bit soundcards are becoming more and more popular, especially on the
  106. PC. The common file format over there is Microsoft's (yuck! :)) RIFF-
  107. WAVE format.
  108. I didn't find any CLI based program to play back 16 bit recordings, on a
  109. standard Amiga, so I decided to write one myself.
  110.  
  111.  
  112. Why CLI based and no GUI?
  113. -------------------------
  114. There are so many GUI based directory utilities, simply use Play16 as an
  115. external player. Consult the manual of your software package on how to
  116. do it. Application example: Assign "Play16 <filename> PRELOAD" to a button
  117. called "Jingle". Select the desired soundfile and press the Jingle-button.
  118. Wait for the appropriate moment and hit the return key - here comes the
  119. sound! Nice when audio dubbing your home videos or even on parties :-)
  120.  
  121.  
  122. How does it work? (technical info)
  123. ----------------------------------
  124. The standard Amiga audio device is limited to 8 bit / 28 kHz playbck
  125. when using DMA. With the introduction of ECS the 28 kHz DMA barrier
  126. was broken - but only if the current displaymode was one with double
  127. scan rate like productivity. The reason for this is the dependency
  128. between video and audio DMA. If you don't have ECS or if you simply
  129. don't want to switch to Productivity just to listen to your desired
  130. sound, Play16 can halve the sample rate during playback.
  131.  
  132. Another way to archieve high output rates is using IRQ. This works no
  133. matter what the displaymode is. I've been experimenting on that long
  134. before I started writing Play16 but there was so much jitter that my
  135. current downsampling method sounds much better.
  136.  
  137. To play back even long sounds, the popular method of double buffering
  138. is used. Alternatively, all data can be loaded into memory before
  139. playback. This is useful when playing short sounds or when loading
  140. the sound from floppy disk or slow CD ROM.
  141.  
  142. The 14 bit output is archieved by setting the first channel on each
  143. side to volume 64 and the second to volume 1. The louder channel then
  144. plays the upper 8 bits as usual while the other channel plays the
  145. 6 most significant bits of the low byte synchronously. Because timing
  146. is very crucial in this case it is nessecary to write directly to
  147. hardware registers instead of using the audio.device. This method may
  148. not work on future amiga models if there ever will be any... :-/
  149.  
  150. Unfortunately, Amiga's DACs are not perfectly linear. A significant
  151. increase in sound quality can be archieved by calibrating each
  152. MSB conversion step individually for your machine. Christian Buchner's
  153. CyberSound system supports this kind of calibration. Play16 can load
  154. the preferences file generated by Christian's calibration program.
  155.  
  156. The MPro output uses the maestix.library by Richard Körber. Have a look
  157. at the Maestix package available on AMINET for further details.
  158.  
  159. =========================== Section 3: Options ============================
  160.  
  161. What options are provided?
  162. --------------------------
  163. There are three ways to specify the options, which are:
  164.  
  165.  CLI:       In the commandline, using standard AmigaOS 2.x template
  166.  Workbench: In the icon, using standard Amiga Workbench tooltype entries
  167.  General:   By setting environment variables. This is not possible for
  168.             all options yet.
  169.  
  170. If you are not familiar with the AmigaOS 2.x commandline template, see
  171. the examples below and consult the AmigaOS manual for furhter information.
  172. The tooltype entries are identical to the keywords you can specify in the
  173. commandline. Also, the environment variables have the same names and reside
  174. in ENV:Play16. 
  175.  
  176. Basic options: (All options marked with (*) have corresponding env-vars.)
  177.  
  178. VERBOSITY/N Sets the level of verbosity.
  179.             0: Just display the banner and error messages
  180.             1: Print additional information about the sound file,
  181.                allocated memory, etc.
  182.             2: Progress information
  183.             3: Debugging information (may look a bit weird :)
  184.             Default is level 0.
  185.  
  186. FAST/S      Do NOT automatically switch to half sample rate if the
  187.             soundfile's rate exceeds 28 kHz. Use this option when
  188.             running your Amiga in Productivity or similar display
  189.             modes.
  190.  
  191. HIFI/S      Obsolete since V1.4 but still included for compatibility
  192.             reasons. See "OUTPUT/K".
  193.  
  194. OUTPUT/K(*) Set Play16's output device. Possible options are:
  195.  
  196.  Paula8      Standard 8 bit output through Amiga hardware. This option
  197.              is the default.
  198.  
  199.  Paula14     Turn on the 14 bit output. Watch out! This is a nasty routine
  200.              that writes directly to some hardware registers. I've done
  201.              everything I can to prevent Play16 from interfering with
  202.              other running tasks in this case but you'll never know...
  203.              Use it with care!
  204.  
  205.  Paula14c    Same as Paula14 but using the calibration preferences for
  206.              much better sound quality. See Section 2 for details.
  207.  
  208.  MPro        Use MacroSystem's Maestro Pro board for output. 44.1kHz and
  209.              48kHz sounds only. For 44.1kHz output a valid and stable
  210.              signal has to be present on the standard input. See the
  211.              manuals of Maestix and the MPro board for further info.
  212.  
  213.  8SVX        Do not play the sound but create an IFF-8SVX file containing
  214.              the data. Basically this is the output generated by <Paula8>
  215.              redirected into a file. The filename will be the input file's
  216.              name with "iff" appended.
  217.  
  218.              WARNING: All limitations of <Paula8> apply here as well,
  219.              which are:
  220.              - Every 16 bit sound will be cropped to 8 bits resulting in
  221.                loss of quality.
  222.              - If you DO NOT set the FAST keyword, the sample rate of the
  223.                output file will be limited to 28kHz and downsampled
  224.                automaticlly if nessecary.
  225.              I recommend to keep the original file if you have enough
  226.              space. If you don't you may be disappointed of your converted
  227.              8 bit sounds when you buy a better sound system!
  228.  
  229. FILTER/K(*) FILTER=ON  : Enable audio filter for playback
  230.             FILTER=OFF : Disable audio filter for playback
  231.             FILTER=AUTO: Turn filter on or off depending on sample rate
  232.             If you don't specify this keyword Play16 will leave the
  233.             hardware registers of the audiofilter completely untouched.
  234.  
  235. LOOPS/N     Determines the number of loops to be played.
  236.             Default is 1 loop. (Play the sound once.)
  237.             LOOPS=0 means infinite number of loops.
  238.  
  239.  
  240. Advanced Options:
  241.  
  242. WINDOW/K(*)   Specify output window for Workbench startup. This Keyword can
  243.               only be used in the ToolType entries of the Play16 icon itself.
  244.               If you don't set this, the hardcoded default will be used.
  245.  
  246. SCREENMODE/N  Type of screen to open during playback. If you set
  247. (*)           SCREENMODE=0, a standard productivity screen will
  248.               be opened.
  249.  
  250. PATH/K        Set the default path for the filerequester. In the command
  251.               line, specifying just a path instead of a filename has the
  252.               same effect.
  253.  
  254. SINGLE/S      Use only one buffer rather then two and load all data into
  255.               memory before playback.
  256.  
  257. PRIORITY/N    Set Play16's task priority. May vary from -25 to 25, default
  258.               is 1.
  259.  
  260. BUFFER/N      Buffersize in samples. May vary from 32768 to 131072. The
  261.               amount of allocated memory also depends on whether the sound
  262.               is mono or stereo, 8 bit or 16 bit.
  263.               Default is 65536 samples, values are rounded to multiples of
  264.               32768.
  265.               Note that it is useless to modify this value when in single
  266.               buffer mode :)
  267.  
  268. PRELOAD/S     Load enough data into memory for immediate start of playback
  269.               at a keypress
  270.  
  271. RAW/S         Disable autodetect and tell Play16 what the actual format of
  272.               the sound data is.
  273.               However, if Play16 can't detect the filetype it will switch
  274.               to RAW mode automatically. If you don't want this to happen
  275.               you can specify STRICT:
  276.  
  277. STRICT/S      Play only files that are supported by the autodetect routine
  278.               Use this if you don't want to get scared by the sudden noisy
  279.               output when trying to play back other data than sound :-)
  280.  
  281. Examples:
  282.  
  283. a) Play16 music.wav
  284.     Simply play the file called music.wav once and directly from harddisk.
  285.  
  286. b) Play16 music.wav SINGLE
  287.     Same as above but load all data into memory before playback. Use this
  288.     when loading soundfiles from floppy disk.
  289.  
  290. c) Play16 music.wav SINGLE VERBOSITY=1
  291.     Same as b, but with additional information being printed out.
  292.  
  293. d) Play16 rhythm.wav LOOPS=10
  294.         Play the rhythm as a continuous loop, i.e. over and over again (10 times)
  295.  
  296. e) Play16 explosion.wav SINGLE PRELOAD
  297.     Load the complete explosion sound into memory, then wait for you to hit
  298.     <return> before playback.
  299.  
  300. f) Play16 MyFavouriteTune.wav FAST OUTPUT=8SVX
  301.     Convert the given file to IFF-8SVX without changing the sample rate.
  302.  
  303. g) Play16 MyFavouriteTune.wav OUTPUT=8SVX
  304.     Same as f but limit the sample rate of the converted file to 28kHz!
  305.  
  306. The following options tell Play16 what parameters to use when in RAW mode.
  307. This happens either if you set the RAW keyword or if Play16 could not
  308. identify the file and STRICT was _not_ set.
  309.  
  310.  
  311. Options when in RAW mode:
  312.  
  313. FREQ/N      Sampling frequency in Hz
  314. TRACKS/N    Number of tracks, 1 for mono, 2 for stereo
  315. BITS/N      Resolution in bits, may be 8 or 16
  316. HEADER/N    Length of header: This is the number of bytes to be skipped
  317.                               at the beginning of the file.
  318. UNSIGNED/S  Data is unsigned, not signed (only valid for  8 bit sounds)
  319. INTEL/S     Data is in Intel format      (only valid for 16 bit sounds)
  320. ULAW/S      Data is compressed using the uLaw compression scheme
  321.  
  322. The default settings are: 22050 Hz, mono, 8 bits, no header.
  323.  
  324.  
  325.  
  326. How do I use this RAW mode?
  327. ---------------------------
  328. Umm, err, difficult to explain, even harder to understand...
  329. Well, if you know the data format of the soundfile, simply set RAW, FREQ,
  330. TRACKS, BITS, UNSIGNED and INTEL accordingly. If you don't, the only
  331. way to find it out is by trial and error :) Here are some tips to make
  332. it a bit easier:
  333.  
  334. Don't set HEADER to an odd number. (Leave it at 0, first.)
  335. If you set BITS to 16 and hear nothing but noise, try to set INTEL.
  336. If you set BITS to 8 and the sound is distorted, try to set UNSIGNED.
  337. If the above does not help, try different combinations of BITS, INTEL
  338. and UNSIGNED.
  339.  
  340. If you manage to get a recognisable sound output which is either too
  341. fast or too slow, start experimenting on TRACKS and FREQ.
  342.  
  343. If you want to play known files and raw ones without changing the command
  344. line, simply specify all you know about the raw data and leave out the
  345. RAW and the STRICT keyword. If Play16 can indentify the file it will use
  346. its parameters. If the filetype is unknown your specified parameters will
  347. be used instead.
  348.  
  349.  
  350. Legal stuff
  351. -----------
  352. Play16 is copyrighted freeware. It may be distributed freely as long as
  353. no modifications are made to the executable and this document. A nominal
  354. fee may be asked to cover distribution costs.
  355.  
  356. Play16 may not be used for any commercial purposes or included with any
  357. commercial product without the written permission of the author.
  358.  
  359. No responsibilities are taken for damaged speakers, amplifiers, Amigas
  360. or any other components or data involved while using Play16.
  361.  
  362. Although I've done some beta testing I can't guarantee that Play16 will
  363. not crash! If you find any bugs, let me know.
  364.  
  365. It is NOT the fault of MacroSystem NOR does it represent the quality of
  366. their products if the MPro output or the maestix.library should fail.
  367.  
  368.  
  369. Miscellaneous
  370. -------------
  371. I don't claim Play16 to be fast. I've done some optimizing - but because
  372. the loader/converter module is a universial one, more data is actually
  373. being moved around different memory blocks than needed for playback.
  374. However, I've implemented separate optimized routines for 8 bit and
  375. for 14/16 bit.
  376.  
  377. * Please note that English is not my native language :)
  378.  
  379. I can be reached at...
  380.  
  381. Internet: wenzel@unixserv.rz.fh-hannover.de (preferred)
  382.           Thomas_Wenzel@aventure.fido.de
  383. Fido:     2:243/6050.28 or 2:241/1035.6
  384.           Mail routing _is_sometimes_ unreliable in FidoNet :-(
  385.  
  386. If you use this program, please send me a mail. I'd like to know how many
  387. people are interested in it at all.
  388.  
  389.  
  390. History
  391. -------
  392. V0.5ß   - Initial beta test release
  393.  
  394. V0.6ß   - Optimized the code a bit.
  395.  
  396. V0.7ß   - Fixed some severe bugs that caused Play16 to crash when trying
  397.           to load corrupted files.
  398.  
  399. V0.8ß   - Play16 can now be stopped by pressing ctrl-c during playback. The
  400.           buffer that is currently being played will be finished first.
  401.         - Automatic filter control depending on sample rate.
  402.  
  403. V0.9ß   - Added 'loop'-option. Sample can be played several times.
  404.         - All time consuming routines now in hand optimized assembler code.
  405.  
  406. V1.0ß   - Play16 now uses standard OS2.x commandline template.
  407.           Thanks to Kai for persuading me to do this :)
  408.  
  409. V1.0    - Done some minor bugfixes.
  410.  
  411. V1.1    - Oops! Play16 caused some Enforcer hits. Fixed that.
  412.           Thanks to Rod Schnell for reporting it.
  413.         - Added 'single'-option. Sound can be loaded completely into memory
  414.           before playing. No looping possible in this case yet!
  415.         - Playback time in minutes:seconds displayed if verbose >= 1
  416.         - uLaw decompression for WAVE-Files, using a decoding table
  417.           for maximum speed (didn't do much testing on it, hope it works!)
  418.         - MAUD filetype support (why do there have to be so many formats?)
  419.         - AIFF filetype support
  420.         - ctrl-c now stops playback immediately.
  421.           Thanks to Marc for some programming tips about that.
  422.  
  423. V1.2    - IFF-8SVX filetype support (only uncompressed files!)
  424.         - RAW data support: _Any_ data can be played
  425.         - Preload feature added
  426.         - Fixed a bug that caused illegal memory access (hopefully)
  427.           Thanks to Ignatios Souvatzis for reporting it.
  428.         - Improved chunk handling
  429.  
  430. V1.3    - 14 bit output (finally!)
  431.         - Any file Play16 can't recognise is considered raw data unless
  432.           you set the STRICT keyword
  433.         - Fixed a bug in WAV filetype length determination
  434.         - Advanced audiofilter control / original state will be restored
  435.           after playback
  436.         - More information about sound (AUTHOR or ANNO-Chunk) is being
  437.           printed out if VERBOSE>=1. However, Play16 will *not* search
  438.           the whole file for that string. If it doesn't come before the
  439.           sound data -- bad luck :-)
  440.  
  441. V1.3a   - Bugfix in chunk handling routine: Chunks with an odd length
  442.           were treated incorrectly. This bug accompanied all versions
  443.           of Play16, even V1.0. However, I decided to release a fix now
  444.           instead of letting you wait until V1.4 is finished.
  445.  
  446. V1.4    - Wildcard and multiple file support
  447.         - Environment variable support (partial)
  448.         - A filerequester will pop up if no filename is given
  449.         - Workbench support, including icon with tooltype entries
  450.         - Maestro Pro output, using Richard Körber's Maestix package
  451.         - Calibrated 14 bit output, using Christian Buchner's
  452.           CyberSound package
  453.         - IFF-8SVX file dump
  454.         - Creative VOC support (currently only 1st data block)
  455.           (This format crazy :-))
  456.         - Closing the output window now stops playback, too
  457.         - Looping now for single mode as well, LOOPS=0 won't cause
  458.           a severe crash any more
  459.           Thanks to Andy Church for reporting it.
  460.         - Open a screen during playback, e.g. productivity for fast DMA
  461.         - German docs
  462.  
  463. V1.5    - Fixed a bug that caused enforcer hits when running Play16
  464.           from CLI
  465.         - Changed the depth of Play16's productivity screen to 1 bitplane
  466.           to reduce CPU- and DMA-load
  467.         - "Play16 <path>" now opens a filerequester pointing to the
  468.           specified path. The new PATH tooltype does the same.
  469.         - Fixed mono playback of raw tracks.
  470.         - uLaw decompression for MAUD, too
  471.         - Fibonacci Delta decompression for 8SVX, thanks to Ralph Wermke
  472.           for the specs.
  473.  
  474. Future plans
  475. ------------
  476. - Better Creative-VOC support
  477. - ADPCM decompression (still having difficulties coding the algorhytm!
  478.                       If you have a working ADPCM4 decoder, please contact me)
  479. - some of the file types saved by Macintosh software (e.g. Sound-Designer)
  480. - Datatypes support
  481.  
  482. Known bugs
  483. ----------
  484. Some files have additional information stored AFTER the waveform data.
  485. Play16 does not recognise that and tries to play the data, resulting
  486. in a short 'blip' at the end of the sound. So far I've only encountered
  487. *some* WAVs that have this additional chunk at the end of the file.
  488.  
  489. Looping of Fibonacci Delta sounds may be distorted.
  490.  
  491. Credits
  492. -------
  493. Thanks go to the following persons:
  494.  
  495. Kai Stuke         for many vital hints on C programming and the Amiga
  496.                   audio device and for beta testing this program.
  497.  
  498. Marc Führer       for doing some beta testing as well, giving valuable
  499.                   hints on optimizing the code and translating this document
  500.                   into German.
  501.  
  502. Clete Baker       for supplying the AIFF- and SDII specs.
  503.  
  504. Richard Körber    for writing the Maestix Library and making it freeware.
  505.  
  506. Christian Buchner for his research and ideas on how to improve the
  507.                   14bit output by calibrating the DACs individually.
  508.  
  509. And to all the people who wrote me!
  510.